<?php
namespace app\wxapp\controller;
use app\common\entity\Result;
use app\Request;
use app\wxapp\service\UploadService;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/10/23 0023
 * Time: 11:33
 */
class Upload extends Base {

    /**
     *
     */
    /**
     * 小程序端 上传语音  
     * @param Request $request
     * @return \think\Response
     */
    public function uploadVoiceColloquial(Request $request){
        $file = $request->file('file');
        $videoId = $request->param('id');
        $time = $request->param('time');

        if(empty($videoId) || empty($time)){
            return Result::error('缺少参数');
        }

        try{
            $service = new UploadService();
            $data = $service->uploadVoiceColloquial($file,$videoId,$time,$this->user['id']);
        }catch (\Exception $e){
            return Result::error($e->getMessage());
        }
        return Result::success($data);
    }
}